// 暴力解法

class Solution {
    public int[] maxSlidingWindow(int[] nums, int k) {
        if(nums == null || nums.length == 0) {
            return new int[0];
        }
        int[] res = new int[nums.length - k + 1];
        int index = 0;
        for(int i = 0; i < nums.length; i++) {
            if(i >= k - 1){
                int max = nums[i];
                for(int j = i - 1; j > i - k; j--){
                    if(max < nums[j]){
                        max = nums[j];
                    }
                }
                res[index++] = max;
            }
        }
        return res;
    }
}